<?php
/**
 * 活动（游戏）
 *
 * @author Administrator
 *
 */
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MyMessage extends Model
{
    protected $table = 'my_message';

    protected $guarded = [''];

    protected $fillable =array('title','content','uid','message_type','type');

    protected function getDateFormat()
    {
        return 'U';
    }

    static function createMessage($uid,$title,$message_type="official",$content,$ext,$end,$type=''){
        self::create(array(
            'uid'=>$uid,
            'title'=>$title,
            'type'=>$type,
            'message_type'=>$message_type,
            'content'=>'<section class="white-bg inforBlock content">
	   <h1 class="f133 mt10">'.$title.'</h1>
	   <div class="mt10 mb10 dark2_gray">
	   	  <p class="lightgray2 mb10">'.date('Y年m月d日 H:i:s',time()).'</p>
	   	  <p class="mt10">'.$content.'</p>
	   </div>
	   <div class="borderLine"></div>'.$ext.'<div class="mt10 lightgray2">'.$end.'</div>
    </section>'
        ));
    }


    public function user()
    {
        return $this->belongsTo('App\Models\User', 'uid', 'uid');
    }

}
